'use client';

import { useAuthStore } from '@/store/auth.store';
import type { AuthStore } from '@/store/types';

export const useAuth = () => {
  const user = useAuthStore((state: AuthStore) => state.user);
  const isAuthenticated = useAuthStore((state: AuthStore) => state.isAuthenticated);
  const loading = useAuthStore((state: AuthStore) => state.loading);
  const error = useAuthStore((state: AuthStore) => state.error);
  const login = useAuthStore((state: AuthStore) => state.login);
  const logout = useAuthStore((state: AuthStore) => state.logout);
  const clearError = useAuthStore((state: AuthStore) => state.clearError);

  return {
    user,
    isAuthenticated,
    loading,
    error,
    login,
    logout,
    clearError,
  };
}; 